import request from "./request";
import { type AxiosResponse } from "axios";
import type { DiagQuery } from "@/types/diag";
import type { ApiResponse } from "@/types/response";

// diag-list
export const getDiagList = async (query: DiagQuery): Promise<AxiosResponse<ApiResponse>> => {
  const response = await request.get(`/api/records/diag_list?page=${query.page}`);
  return response
};

// record-detail
export const getRecordDetail = async (id: string): Promise<AxiosResponse<ApiResponse>> => {
  const response = await request.get(`/api/records/${id}`);
  return response
};

// fb-quest
export const getFeedbackQuest = async (id: string): Promise<AxiosResponse<ApiResponse>> => {
  const response = await request.get(`/api/questionnaire/feedback/${id}`);
  return response
};

export const getQuestionnaire = async (id: string): Promise<AxiosResponse<ApiResponse>> => {
  const response = await request.get(`/api/questionnaire/${id}`);
  return response
};

export const postAnswer = async (id: string, data: object): Promise<AxiosResponse<ApiResponse>> => {
  const response = await request.post(`/api/questionnaire/${id}/answer`, data);
  return response
};
